package com.mbmed.doctor.commons.vo.exception;

import com.mbmed.doctor.commons.utils.ReflectUtil;


public class AdviceException extends RuntimeException {

	private static final long serialVersionUID = -4987557572623181694L;

	public AdviceException() {
		super();
	}

	public AdviceException(String message) {
		super(message);
	}

	public AdviceException(Throwable cause) {
		super(cause);
	}

	public AdviceException(String message, Throwable cause) {
		super(message, cause);
	}
	
	public static AdviceException getDetailMessage(Exception e ){
		if(e instanceof AdviceException){
			return (AdviceException) e;
		}
		String detailMessage = ReflectUtil.getFieldValue(e.getCause(), "detailMessage");
		return new AdviceException(detailMessage);
	}
}
